class User{

  constructor(name) {
    this.data = {name}
  }
  
  get name() {
    console.log('get...')
    return this.data.name
  }

  set name(value) {
    if (value.trim() == "") throw new Error("invalid params");
    this.data.name = value;
  }
}


var user = new User("向军")

console.log(JSON.stringify(user))

user.name = '2323'
console.log(user.name)
console.log(JSON.stringify(user))








